Positioning Dialog Boxes and Rectangles
Standard image-compression dialog components provide functions that allow you to position rectangles and dialog boxes. These functions are most useful in helping you to manage dialog boxes that are related to the standard image-compression dialog. For example, your application might support a custom button that initiates a dialog box with the user to specify additional compression parameters. You can use these functions to position that dialog box in relation to the standard image-compression dialog box.
There are two positioning functions: the
SCPositionRect
function positions a rectangle; the
SCPositionDialog
positions a dialog box. The
SCGetBestDeviceRect
function returns information about the best available display device.
SCPositionRect
The
SCPositionRect
function positions a rectangle on the screen. You indicate where you want to put the rectangle by specifying the desired coordinates of the upper-left corner of the rectangle.
pascal ComponentResult SCPositionRect (ComponentInstance ci,
Rect *rp, Point *where);
-
ci
-
Identifies your application's connection to a standard image-compression dialog component.
-
rp
-
Contains a pointer to a rectangle structure. When you call the
SCPositionRect
function, this structure should contain the rectangle's current global coordinates. The
SCPositionRect
function adjusts the coordinates in the structure to reflect the rectangle's new position.
-
where
-
Contains a pointer to a point in global coordinates identifying the desired location of the upper-left corner of the rectangle. This parameter allows your application to position the rectangle on the screen.
-
The standard image-compression dialog component supports two special values for this parameter. If you set this parameter to (-1,-1), the component places the rectangle on the display device that has the menu bar. The component centers the rectangle horizontally on that device. The component vertically positions the rectangle so that 1/3 of the vertical space that is not used by the rectangle remains above the rectangle, and the remaining 2/3 of the unused space is below the rectangle.
-
If you set this parameter to (-2,-2), the component places the rectangle on the display device that supports the highest color or grayscale resolution. The component positions the rectangle as it does for the other special value. This option displays images most clearly and is the recommended value for most cases.
-
The
SCPositionRect
function adjusts the coordinates of this point to correspond to the upper-left corner of the rectangle.
RESULT CODE
paramErr
|
-50
|
Invalid parameter specified
|
SCPositionDialog
The
SCPositionDialog
function helps you to position a dialog box on the screen.
pascal ComponentResult SCPositionDialog (ComponentInstance ci,
short id, Point *where);
-
ci
-
Identifies your application's connection to a standard image-compression dialog component.
-
id
-
Specifies the resource number of a
'DLOG'
resource. The
SCPositionDialog
function positions the dialog box that corresponds to this resource.
-
where
-
Contains a pointer to a point in global coordinates identifying the desired location of the upper-left corner of the dialog box. This parameter allows you to indicate how you want to position the dialog box on the screen.
-
The standard image-compression dialog component supports two special values for this parameter. If you set this parameter to (-1,-1), the component places the dialog box on the display device that has the menu bar. The component centers the dialog box horizontally on that device. The component vertically positions the dialog box so that 1/3 of the vertical space that is not used by the box remains above the box, and the remaining 2/3 of the unused space is below the box.
-
If you set this parameter to (-2,-2), the component places the dialog box on the display device that supports the highest color or gray scale resolution. The component positions the dialog box as it does for the other special value. This option displays images most clearly and is the recommended value for most cases.
-
The
SCPositionDialog
function adjusts the coordinates of this point to correspond to the upper-left corner of the dialog box.
DESCRIPTION
You indicate where you want to put the dialog box by specifying the desired coordinates of the upper-left corner of the box. The component then derives appropriate location information for the dialog box based upon its size and the display characteristics of the destination device, and returns that location information to your program. You can then pass that information to the Dialog Manager when you want to display the dialog box.
RESULT CODES
paramErr
|
-50
|
Invalid parameter specified
|
Resource Manager errors
SCGetBestDeviceRect
The
SCGetBestDeviceRect
function determines the boundary rectangle that surrounds the display device that supports the largest color or grayscale palette.
pascal ComponentResult SCGetBestDeviceRect (ComponentInstance ci,
Rect *r);
-
ci
-
Identifies your application's connection to a standard image-compression dialog component.
-
r
-
Contains a pointer to a rectangle structure. The
SCGetBestDeviceRect
function returns the global coordinates of a rectangle that surrounds the appropriate display device.
DESCRIPTION
The
SCGetBestDeviceRect
function determines the boundary rectangle that surrounds the display device that supports the largest color or grayscale palette. If more than one device supports the same pixel depth, the function returns information about the device that has the highest resolution.
Note that the function subtracts the menu bar from the returned rectangle if the best device is also the main display device.
The standard image-compression dialog component uses this function to position rectangles and dialog boxes when you indicate that the component is to choose the best display device. In general, your application does not need to use this function.
RESULT CODE
paramErr
|
-50
|
Invalid parameter specified
|
© 1997 Apple Computer, Inc.Previous | Chapter Top | Chapter Contents | Next